//vite主程序
const { PORT } = require('./config');
const { createServer, app } = require('./server');
const { createContext } = require('./context');
const { resolvePlugins } = require('./plugins');
const plugins = require('../packages/plugins');

(async function () {
  //创建应用服务
  const server = await createServer();
  //创建执行期上下文
  const context = await createContext(app);

  //专门处理插件内的函数
  resolvePlugins(context, plugins);

  server.listen(PORT, () => {
    console.log(`Server is running on ${PORT}.`);
  });
})();
